export class Aborter {
  private canceller?: AbortController;
  single(): AbortController {
    this.canceller?.abort();
    this.canceller = new AbortController;
    return this.canceller;
  }
  get(): AbortController {
    this.canceller = this.canceller ?? new AbortController;
    return this.canceller;
  }
  abort(): void {
    this.canceller?.abort();
  }
  clear(): void {
    delete this.canceller;
  }
  running(): boolean {
    return !!this.canceller;
  }
}